From fdb5b62d0f43de06c4bb3cc420afcf351b725f82 Mon Sep 17 00:00:00 2001 From: Debian Science Maintainers Date: Tue, 28 Jan 2020 22:29:29 +0000 Subject: [PATCH] Use scipy.special not scipy.misc factorial, comb and logsumexp have been moved: trying to import them from the old location is an error in scipy 1.3+. https://ci.debian.net/data/autopkgtest/unstable/amd64/s/statsmodels/2949940/log.gz Author: Rebecca N. Palmer Forwarded: accepted https://github.com/statsmodels/statsmodels/pull/6164 Gbp-Pq: Name scipy13_compat.patch --- examples/python/discrete_choice_example.py | 2 +- statsmodels/distributions/edgeworth.py | 2 +- statsmodels/sandbox/infotheo.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/python/discrete_choice_example.py b/examples/python/discrete_choice_example.py index 1aff497..97c7955 100644 --- a/examples/python/discrete_choice_example.py +++ b/examples/python/discrete_choice_example.py @@ -126,7 +126,7 @@ formula += '+ PCTYRRND + PERMINTE*AVYRSEXP*AVSALK + PERSPENK*PTRATIO*PCTAF' stats.binom(5, 1. / 6).pmf(2) -from scipy.misc import comb +from scipy.special import comb comb(5, 2) * (1 / 6.)**2 * (5 / 6.)**3 from statsmodels.formula.api import glm diff --git a/statsmodels/distributions/edgeworth.py b/statsmodels/distributions/edgeworth.py index 4eb0391..42b18a9 100644 --- a/statsmodels/distributions/edgeworth.py +++ b/statsmodels/distributions/edgeworth.py @@ -124,7 +124,7 @@ class ExpandedNormal(rv_continuous): >>> import matplotlib.pyplot as plt >>> from scipy import stats - >>> from scipy.misc import factorial + >>> from scipy.special import factorial >>> df = 12 >>> chi2_c = [2**(j-1) * factorial(j-1) * df for j in range(1, 5)] >>> edgw_chi2 = ExpandedNormal(chi2_c, name='edgw_chi2', momtype=0) diff --git a/statsmodels/sandbox/infotheo.py b/statsmodels/sandbox/infotheo.py index 7fbec50..6af5775 100644 --- a/statsmodels/sandbox/infotheo.py +++ b/statsmodels/sandbox/infotheo.py @@ -36,7 +36,7 @@ from statsmodels.compat.python import range, lzip, lmap from scipy import stats import numpy as np from matplotlib import pyplot as plt -from scipy.misc import logsumexp as sp_logsumexp +from statsmodels.compat.scipy import logsumexp as sp_logsumexp #TODO: change these to use maxentutils so that over/underflow is handled #with the logsumexp. -- 2.30.2